﻿/*
 Copyright aswing.org, see the LICENCE.txt.
*/

import org.aswing.awml.AwmlNamespace;
import org.aswing.awml.component.ContainerParser;
import org.aswing.MCPanel;

/**
 * Parses {@link org.aswing.MCPanel} level elements.
 * 
 * @author Igor Sadovskiy
 */
class org.aswing.awml.component.MCPanelParser extends ContainerParser {
	
	/** Default MC Panel */
	public static var DEFAULT_MOVIE_CLIP:MovieClip = _root;
	
	private static var ATTR_MOVIE_CLIP:String = "movie-clip";
	
	/**
	 * Constructor.
	 */
	public function MCPanelParser(Void) {
		super();
	}
	
	public function parse(awml:XMLNode, panel:MCPanel, namespace:AwmlNamespace):MCPanel {
		
		// get panel MC
		var mc:MovieClip = getAttributeAsMovieClip(awml, ATTR_MOVIE_CLIP, _root);
		
		if (panel == null) {
			panel = new MCPanel(mc);	
		}
		
		super.parse(awml, panel, namespace);
		
		return panel;
	}

}
